<?php
namespace NieGe;


class Redis
{
    private static $_instanse = null;

    private static function init()
    {
        self::$_instanse = new \Redis();
        $host = env('redis.host') ?? '127.0.0.1';
        $prot = env('redis.prot') ?? 6379;
        $pass = env('redis.password') ?? '';
        self::$_instanse->connect($host,$prot);
        self::$_instanse->auth($pass);
    }

    public static function getInstance()
    {
        if(self::$_instanse == null){
            self::init();
        }
        return self::$_instanse;
    }
}